package com.example.alilive.controller;

/**
 * @Title:
 * @Description:
 * @author: cc
 * @Date: 2020/3/3 10:25
 **/

import com.example.alilive.common.AliyunLiveConfigInfo;
import com.example.alilive.utils.AliyunLiveUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("video")
public class VideoController {

    @Autowired
    AliyunLiveConfigInfo configInfo;
    /**
     * 获取拉流
     * @param
     * @return
     */
    @GetMapping("/getLivePath")
    public Map<String, String>  getLivePath(@RequestParam final String videoName) {
      return  AliyunLiveUtils.createPlayUrl(configInfo,videoName);

    }
    /**
     *
     * 创建推流
     * @param sourceId 资源id
     * @return
     */
    @GetMapping("/getCreateLivePath")
    public String  getCreateLivePath(@RequestParam final String sourceId) {
        return  AliyunLiveUtils.createPushUrl(configInfo,sourceId);

    }
}
